package MyLinkedList;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

public class Test {


    public int evalRPN(String[] tokens) {
        Stack<Integer> stack = new Stack<>();


        for(String s : tokens) {
            if(!isOpera(s)) {
                stack.push(Integer.parseInt(s));
            }
            else {
                int num2 = stack.pop();
                int num1 = stack.pop();
                switch(s) {
                    case "+" :
                        stack.push(num1+num2);
                        break;
                    case "-" :
                        stack.push(num1-num2);
                        break;
                    case "*" :
                        stack.push(num1*num2);
                        break;
                    case "/" :
                        stack.push(num1/num2);
                        break;
                }
            }
        }
        return stack.pop();
    }

    public boolean isOpera(String x) {
        if(x.equals("+") || x.equals("-") || x.equals("*") || x.equals("/")) {
            return true;
        }
        else {
            return false;
        }
    }

    public static void main(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        myLinkedList.addFist(1);
        myLinkedList.addFist(2);
        myLinkedList.addFist(3);
        //myLinkedList.addInsert(3,-1);
        //myLinkedList.remove(-1);
        //myLinkedList.removeAllKey(1);
        //myLinkedList.clear();
        myLinkedList.display1(myLinkedList.head);
        myLinkedList.display2(myLinkedList.head);
        myLinkedList.display3();
        System.out.println(myLinkedList.contains(3));
        System.out.println();
    }



}
